// 医院列表 请求
import { request } from "@/utils/http";
import {
  PagingListRequest,
  hospitalListRequest,
  regionReturnResultType,
  hospitalInformationType,
  hospitalDepartmentReturnType, //科室管理请求的返回值类型
  getRuleDataType, //获取排班规则数据的返回值
  getWorkReturnDateRequest,
} from "./model/hospitalListTypes";
//1.获取医院列表数据的请求
export const SendHospitalListRequest = (
  page: number,
  limit: number,
  paramsList: PagingListRequest
) => {
  return request.get<any, hospitalListRequest>(
    `/admin/hosp/hospital/${page}/${limit}`,
    {
      params: paramsList,
    }
  );
};
// 2.获取所有的省份
export const ProvinceTypeRequest = () => {
  return request.get<any, regionReturnResultType>(
    "/admin/cmn/dict/findByDictCode/province"
  );
};
// 3.获取所有的市级和区级区域
export const cityTypeRequest = (idList: string) => {
  return request.get<any, regionReturnResultType>(
    `/admin/cmn/dict/findByParentId/${idList}`
  );
};
// 4.更新上线状态
export const OnlineStatusRequest = (id: string, status: number) => {
  return request.get<any, null>(
    `/admin/hosp/hospital/updateStatus/${id}/${status}`
  );
};
// 5.获取医院基本信息 返回值的类型hospitalInformationType
export const hospitalInformationRequest = (id: string) => {
  return request.get<any, hospitalInformationType>(
    `/admin/hosp/hospital/show/${id}`
  );
};
// 6.获取医院科室数据的请求 接受hoscode作为参数来执行
export const hospitalDepartmentDataRequest = (hoscode: string) => {
  return request.get<any, hospitalDepartmentReturnType>(
    `/admin/hosp/department/${hoscode}`
  );
};
// 7.获取排班规则数据
export const getRuleDataRequest = (
  page: number,
  limit: number,
  hoscode: string,
  depcode: string
) => {
  return request.get<any, getRuleDataType>(
    `/admin/hosp/schedule/getScheduleRule/${page}/${limit}/${hoscode}/${depcode}`
  );
};
// 8.获取workDate排班日期的排班详细列表
export const getWorkDateRequest = (
  hoscode: string,
  depcode: string,
  workDate: string
) => {
  return request.get<any, getWorkReturnDateRequest>(
    `/admin/hosp/schedule/findScheduleList/${hoscode}/${depcode}/${workDate}`
  );
};
